import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';

/**
 * Generated class for the WaitCheckPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */


@Component({
    selector: 'page-wait-check',
    templateUrl: 'wait-check.html',
})
export class WaitCheckPage {
    private selectId: number = 0;
    tab_0: boolean = true;
    tab_1: boolean = false;
    tab_2: boolean = false;
    tab_3: boolean = false;
    waitApproveList: any = [
        {title: '待办事项'},
        {title: '已办事项'},
        {title: '已提交'},
        {title: '未提交'}
    ];

    constructor(public navCtrl: NavController, public navParams: NavParams) {

    }

    ionViewDidLoad() {
        console.log('ionViewDidLoad WaitCheckPage');
        this.tabName('待办事项', 0);

    }
    ionViewDidEnter(){

    }
    tabName(name, id) {
        this.allTabsBool();
        let tabId: any = document.getElementById('check_' + id).style;
        let _selectId: any = document.getElementById('check_' + this.selectId).style;
        _selectId.backgroundColor = 'rgba(0,0,0,0)';
        switch (name) {
            case '待办事项':
                this.selectId = 0;
                this.tab_0 = true;
                tabId.backgroundColor = '#f53d3d';
                break;
            case '已办事项':
                this.selectId = 1;
                this.tab_1 = true;
                tabId.backgroundColor = '#f53d3d';
                break;
            case '已提交':
                this.selectId = 2;
                this.tab_2 = true;
                tabId.backgroundColor = '#f53d3d';
                break;
            case '未提交':
                this.selectId = 3;
                this.tab_3 = true;
                tabId.backgroundColor = '#f53d3d';
                break;
        }
        localStorage.setItem("checkType",JSON.stringify(this.selectId));
        //console.log(JSON.parse(localStorage.getItem('checkType')))
    }

    allTabsBool() {
        this.tab_0 = false;
        this.tab_1 = false;
        this.tab_2 = false;
        this.tab_3 = false;
    }
}
